package com.lzw.mall.common.mapper;

import com.lzw.mall.common.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzw.mall.common.vo.OrderVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lizhenwei
 * @since 2023-04-11
 */
public interface OrdersMapper extends BaseMapper<Orders> {

    @Select("select max(order_code) from orders where instr(order_code,#{pre})=1")
    String selectMaxCode(String pre);

    List<Orders> selectOrderList(@Param("status") String status, @Param("memberId") Integer memberId);

    List<OrderVO> selectListPage(@Param("keyword") String keyword, @Param("status") String status);

    void updateStatus(Integer[] ids);

    @Update("update orders set status=#{status} where order_code=#{outTradeNo}")
    void doUpdateStatus(@Param("outTradeNo") String outTradeNo, @Param("status") String status);
}
